This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
In Mail database, Agent code:
ExportFields:
Option Public
Option Explicit
Sub Initialize
Dim session As New NotesSession
Dim wksp As New NotesUIWorkspace
Dim doc As NotesDocument
Dim db As NotesDatabase
Dim strParam$, varArr
strParam = session.GetEnvironmentString("Param1")
If strParam = "" Then
' do selected document in current view.
Set db = session.CurrentDatabase
If Not (wksp.CurrentDocument Is Nothing) Then
Msgbox "This agent must be run from a view. The user's access is determined by data already stored in the document -- not by the results of field default and computed field formulas after they open the document."
Exit Sub
End If
Set doc = session.DocumentContext
If doc Is Nothing Then
Msgbox "You must highlight a document before you run this agent."
Exit Sub
End If
Else
' Param1 had a value in it. This contains the server name, db filepath, and document UNID delimited by ",")
session.SetEnvironmentVar "Param1", ""
varArr = Split(strParam, ",")
Set db = New NotesDatabase(varArr(0), varArr(1))
Set doc = db.GetDocumentByUNID(varArr(2))
If doc Is Nothing Then
Msgbox "Oops! Can't figure out argument: " & strParam
Exit Sub
End If
End If
WriteFieldsMeta doc
End Sub
Sub WriteFieldsMeta (doc As NotesDocument )
On Error Resume Next
Dim fileNum1 As Integer
Dim FldName As String
Dim FldText As String
Dim FldType As Integer
Dim FldSize As Long
fileNum1% = Freefile
Open "D:\Fields.csv" For Output As fileNum1%
Dim item As NotesItem
Forall i In doc.Items
FldName = i.Name
FldType = i.Type
FldSize = i.ValueLength
Set item =doc.GetFirstItem( FldName ) '
Forall v In item.Values
FldText = v
If v <> " " Or Not Isnull(v) Or Not (v Is Nothing) Then
Write #fileNum1%, FldName, FldText, FldType, Cstr( FldSize )
End If
End Forall
End Forall
Close fileNum1%
Print "File written to D:\Fields.csv"
End Sub
Feedback response number WEBB87QMXU created by ~Umberto Kitookony on 07/26/2010